import yaml
from utils.log_utils import logger
from page_object.base_page import BasePage


class LoginPage(BasePage):

    _base_url = "https://work.weixin.qq.com/wework_admin/loginpage_wx"

    def login(self):
        logger.info("正在登录")

        self.driver.get("https://work.weixin.qq.com/wework_admin/frame")
        # todo 数据脱密，上传时请清空cookie文件内容
        with open("../data/cookie_data.yaml", "r") as f:
            wework_cookie = yaml.safe_load(f)
        for i in wework_cookie:
            self.driver.add_cookie(i)
        self.driver.get("https://work.weixin.qq.com/wework_admin/frame")

        from page_object.home_page import HomePage
        return HomePage(self.driver)

